package model.member;

import java.sql.SQLException;

import com.ibatis.sqlmap.client.SqlMapClient;


public class MemberDao {
	private SqlMapClient client;

	public MemberDao(){}

	public MemberDao(SqlMapClient client) {
		super();
		this.client = client;
	}
	
	public void registerMember(MemberVO vo) throws SQLException{
		client.insert("member.registerMember",vo);			
		System.out.println("insert ok!");
	}	
	
	public String idCheck(String id) throws SQLException{
		return (String)client.queryForObject("member.idCheck", id);
	}
	
	public MemberVO login(MemberVO vo) throws SQLException{
		return (MemberVO) client.queryForObject("member.login",vo);			
	}
	
	public void updateMember(MemberVO vo) throws SQLException{
		client.update("member.updateMember",vo);			
	}
	
	public void deleteMember(String id) throws SQLException {
		client.delete("member.deleteLetterFordeleteMember",id);
		client.delete("member.deleteqnaFordeleteMember",id);
		client.delete("member.deleteMember",id);
	}
	
	public String findPass(String id, String name) throws SQLException {
		return (String)client.queryForObject("member.findPass", id, name);
	}
	
	public String findId(MemberVO mvo) throws SQLException {
		return (String)client.queryForObject("member.findId", mvo);
	}

	public int showHint(MemberVO mvo) throws SQLException {
		return (Integer)client.queryForObject("member.showHint",mvo);
	}

	public String getPass(MemberVO mvo) throws SQLException {
		return (String)client.queryForObject("member.getPass",mvo);
	}
	

}
